﻿using UnityEngine;
using System.Collections;

public class HeroSkillMediator : MediatorBase
{

    [Inject]
    public HeroSkillView view;

    [Inject]
    public HeroSkillModel model;


    public override void Initialize()
    {
        base.Initialize();
        if(view != null)
        {
            UIEventListener.Get(view.skillBtn0).onClick = OnClickSkill;
            UIEventListener.Get(view.skillBtn1).onClick = OnClickSkill;
            UIEventListener.Get(view.testAnimation).onClick = OnClickTest;
        }
    }

    /// <summary>
    /// 测试测试
    /// </summary>
    /// <param name="obj"></param>
    private void OnClickSkill(GameObject obj)
    {
        int id = 0;

        if(obj.name == "Skill0")
        {
            id = 1001;
        }
        else
        {
            id = 1002;
        }

        SkillSystem.instance.ShowSkill(SceneHero.instance.ActorAvatar.actorGO, new GameObject[] { SceneTestActor.instance.ActorAvatar.actorGO }, SkillDataMgr.instance.GetSkillData(id));
    }

    private void OnClickTest(GameObject obj)
    {
        SceneHero.instance.PlayAnimationName(view.animationLabel.text);
    }

    public override void Destroy()
    {
        base.Destroy();
    }

}
